]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
workspaceThumbnails: Pass monitor index to constructor
authorFlorian Müllner <fmuellner@gnome.org>
Fri, 26 Feb 2021 13:09:15 +0000 (14:09 +0100)
committerMarge Bot <marge-bot@gnome.org>
Tue, 2 Mar 2021 21:56:30 +0000 (21:56 +0000)
We'll soon add workspace thumbnails on secondary monitors as well,
so set the monitor explicitly instead of assuming the primary one.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1735>

js/ui/overviewControls.js
js/ui/workspaceThumbnail.js

index d595facae742206b56233eb02c3a2c00eaddcff7..5e2f8f9f83b6c7773b9a4b74b9de754074dcf60f 100644 (file)
@@ -305,8 +305,8 @@ class ControlsManager extends St.Widget {
             this.dash.showAppsButton);
         this._searchController.connect('notify::search-active', this._onSearchChanged.bind(this));
 
-        this._thumbnailsBox =
-            new WorkspaceThumbnail.ThumbnailsBox(this._workspaceAdjustment);
+        this._thumbnailsBox = new WorkspaceThumbnail.ThumbnailsBox(
+            this._workspaceAdjustment, Main.layoutManager.primaryIndex);
         this._thumbnailsBox.connect('notify::should-show', () => {
             this._thumbnailsBox.show();
             this._thumbnailsBox.ease_property('expand-fraction',
index e54e8ab1d358da4c5ace12086236e43f15a334b8..e805c4f522ffb4938693797bdb887e63fd49f16e 100644 (file)
@@ -258,7 +258,7 @@ var WorkspaceThumbnail = GObject.registerClass({
             0, 1, 0),
     },
 }, class WorkspaceThumbnail extends St.Widget {
-    _init(metaWorkspace) {
+    _init(metaWorkspace, monitorIndex) {
         super._init({
             clip_to_allocation: true,
             style_class: 'workspace-thumbnail',
@@ -267,7 +267,7 @@ var WorkspaceThumbnail = GObject.registerClass({
         this._delegate = this;
 
         this.metaWorkspace = metaWorkspace;
-        this.monitorIndex = Main.layoutManager.primaryIndex;
+        this.monitorIndex = monitorIndex;
 
         this._removed = false;
 
@@ -623,7 +623,7 @@ var ThumbnailsBox = GObject.registerClass({
             true),
     },
 }, class ThumbnailsBox extends St.Widget {
-    _init(scrollAdjustment) {
+    _init(scrollAdjustment, monitorIndex) {
         super._init({
             style_class: 'workspace-thumbnails',
             reactive: true,
@@ -641,6 +641,8 @@ var ThumbnailsBox = GObject.registerClass({
         this._indicator = indicator;
         this.add_actor(indicator);
 
+        this._monitorIndex = monitorIndex;
+
         this._dropWorkspace = -1;
         this._dropPlaceholderPos = -1;
         this._dropPlaceholder = new St.Bin({ style_class: 'placeholder' });
@@ -1069,7 +1071,7 @@ var ThumbnailsBox = GObject.registerClass({
 
         for (let k = start; k < start + count; k++) {
             let metaWorkspace = workspaceManager.get_workspace_by_index(k);
-            let thumbnail = new WorkspaceThumbnail(metaWorkspace);
+            let thumbnail = new WorkspaceThumbnail(metaWorkspace, this._monitorIndex);
             thumbnail.setPorthole(this._porthole.x, this._porthole.y,
                                   this._porthole.width, this._porthole.height);
             this._thumbnails.push(thumbnail);
@@ -1297,11 +1299,12 @@ var ThumbnailsBox = GObject.registerClass({
     }
 
     _updatePorthole() {
-        if (!Main.layoutManager.primaryMonitor) {
-            this._porthole = { width: global.stage.width, height: global.stage.height,
-                               x: global.stage.x, y: global.stage.y };
+        if (!Main.layoutManager.monitors[this._monitorIndex]) {
+            const { x, y, width, height } = global.stage;
+            this._porthole = { x, y, width, height };
         } else {
-            this._porthole = Main.layoutManager.getWorkAreaForMonitor(Main.layoutManager.primaryIndex);
+            this._porthole =
+                Main.layoutManager.getWorkAreaForMonitor(this._monitorIndex);
         }
 
         this.queue_relayout();